package exam.ccwtest;

import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class c06_LongClick extends Activity {
	int mCount=0;
	TextView mTextCount;
	
	public void onCreate (Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.c06_longclick);
		
		mTextCount = (TextView)findViewById(R.id.count);
		
		findViewById(R.id.decrease).setOnLongClickListener(mLongClickListener);
		findViewById(R.id.increase).setOnLongClickListener(mLongClickListener);
	}
	
	public void mOnClick (View v) {
		switch (v.getId()) {
		case R.id.decrease:
			mCount--;
			mTextCount.setText("" + mCount);
			break;
		case R.id.increase:
			mCount++;
			mTextCount.setText("" + mCount);
			break;
		}		
	}
	
	View.OnLongClickListener mLongClickListener = new View.OnLongClickListener() {
		
		@Override
		public boolean onLongClick(View v) {
			switch (v.getId()) {
			case R.id.decrease:
				mCount=0;
				mTextCount.setText("롱클릭 선택 : " + mCount);
				return true;
			case R.id.increase:
				mCount = 100;
				mTextCount.setText("롱클릭 선택 : " + mCount);
				return true;
			}
			return false;
		}
	};
}



